-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent ENTER propagation on form #826
Conversation
On "ENTER" keydown on picker, prevent the closest form to be submitted too. Updated PR of #674
@@ -1200,6 +1200,8 @@ | |||
this.fill(); | |||
if (this.picker.is(':visible')){ | |||
e.preventDefault(); | |||
e.stopPropagation && e.stopPropagation(); | |||
e.cancelBubble = true; // IE6,7,8 support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jQuery events' stopPropagation
method does both of these (check for e.stopPropagation
's existence and setting cancelBubble
to true), so just a call to that would work.
https://github.com/jquery/jquery/blob/1.8-stable/speed/jquery-basis.js#L2122
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please replace the check of e.stopPropagation
and the e.cancelBubble = true
with a single e.stopPropagation()
call
Doesn't the |
FF and IE7, IE8 (at least) |
I came by this piece of info, so the combination of preventDefault + stopPropagation should fix this issue!
@fabdouglas please fix the note added above and then this PR should be ready to merge :) |
Fix travis jslint. Also, add a note concerning the event bubbling : http://stackoverflow.com/questions/7596364/whats-the-difference-between-cancelbubble-and-stoppropagation
Thanks @fabdouglas! |
Prevent ENTER propagation on form
On "ENTER" keydown on picker, prevent the closest form to be submitted too.
Updated PR of #674